#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include<math.h>
double funG(double xg)
{
	return xg * xg - 3 * xg;
}

double funF(double xf)
{
	return fabs(xf - 3) + fabs(xf + 1);
}

int main()
{
	double x;
	scanf("%lf", &x);
	double g, f;
	g = funG(x);
	f = funF(g);
	printf("%.2f\n", f);
	return 0;
}